<include file="Public:header" />
<div class="subnav">
  <div class="explain-col" style="position: relative;">
    <form name="searchForm" id="searchForm" method="get" action="__SELF__">
      搜索：
      <input type="text" name="keyword" id="keyword" size="20"  value="" class="input-text" placeholder="请输入关键词" />
      <select name="role_id" id="role_id" onchange="searchForm.submit()">
        <option value="0">所属分组</option>
        <volist name=":get_role_list()" id="vo">
          <option value="{$vo.id}"  >{$vo.name}</option>
        </volist>
      </select>
      <input type="submit" value=" 搜索 " class="button" />
    </form>
    <div class="content-menu" style="position: absolute; right: 30px;top: 5px;"> <a href="javascript:openWinBox('__URL__/add','添加用户');" class="add fb"><em>添加用户</em></a> </div>
  </div>
</div>
<!--subnav-->
<div class="pad-lr-10">
  <form name="myform" id="myform" action="" method="post">
    <div class="table-list">
      <table width="100%" cellspacing="0">
        <thead>
          <tr>
            <th width="50" align="center">ID</th>
            <th align="left">用户名</th>
            <th align="left">所属角色</th>
            <th align="center">上次登录时间</th>
            <th align="left">上次登录IP</th>
            <th align="center" width="50">启用状态</th>
            <th align="center">创建时间</th>
            <th align="center" >操作</th>
          </tr>
        </thead>
        <tbody  id="list">
          <volist name="list" id="vo">
            <tr id="list-{$vo.id}">
              <td align="center">{$vo.id}</td>
              <td align="left">{$vo.username}</td>
              <td align="left">{$vo.role_id|get_role_name}</td>
              <td align="center">{$vo.last_login_time}</td>
              <td align="left">{$vo.last_login_ip}</td>
              <td align="center">{$vo.status|statusArr}</td>
              <td align="center">{$vo.create_time}</td>
              <td align="center">
                  <neq name="vo.id" value="1">
                  【<a href="javascript:openWinBox('__URL__/add/id/{$vo.id}','修改',800,400)" >修改</a>】
                  【<a href="javascript:delConfirm('{$vo.id}');" >删除</a>】
                  </neq>
              </td>
            </tr>
          </volist>
        </tbody>
      </table>
    </div>
  </form>
</div>
</body></html>
<script type="text/javascript">
$(document).ready(function(e) {
	var role_id = "{$Think.get.role_id}";
	$("#role_id").val(role_id);

	$("#group_id").change(function(){
		$("#searchForm").submit();
	})

	$("#keyword").change(function(){
		$("#searchForm").submit();
	})
	/*$(".del").click(function(){
		var id = $(this).attr('name');
		alert(id);
	})*/
});

function delConfirm(id){
	art.dialog({content: '确定删除所选数据吗？',ok: function () { del(id); return true; },cancelVal: '取消',cancel: true});
}

function del(id){
	jQuery.get('__URL__/del',encodeURI('ids='+id),success,'json');
	function success(data){
		if(data.status==1){
			window.top.art.dialog({id:'TNCICC',content: data.info,time: 1,icon:'succeed'});
			$("#list-"+id).remove();
			setTimeout(function(){closeWin(1000);},1000);
		}else{
			window.top.art.dialog({id:'TNCICC',content: data.info,time: 1,icon:'warning'});
		}
	}
}

</script>